-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add pathArgs method in analogy to the args method of ESP8266WebServer #9100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This allows to use UriRegex with optional capture groups and therefore varying number of path arguments.
(sry for delay) I don't think Server params need to be renamed here? |
Just to clarify - you mean just the parameter name
It that case I would say it might possibly lead to slight confusion, but in general I would be fine in changing that back :) |
I meant something like this
Since it is not shadowing anything while in the Server class context edit: Also, check out CI logs down below. It fails when trying to build our example sketches |
Ah, okay - I think I now got what you mean - I will have look at it, maybe not today anymore, but I try to have a look in the next days! |
similar to ::args(), returns number of parsed path arguments shortened esp8266#9100
similar to ::args(), returns number of parsed path arguments shortened esp8266#9100
If you want to use path arguments (pathArg) together with UriRegex and optional catch groups in a regular expression you need to know how many path arguments have been found as the number might vary. Otherwise you might access indices that are not available depending on the number of matched optional catch groups.
This pull request implements the method
pathArgs
in analogy to the methodargs
for normal server arguments.Feel free tell me if something should be changed or if something is missing and also feel free to do changes your self to this PR if you want to.
I hope this features helps someone else as well :) - it makes path matching with regular expressions even more powerful.